<template>
  <div>
    <!-- 三级导航 -->
    <TypeNav></TypeNav>
    <!--列表-->
    <ListContainer></ListContainer>
    <!--今日推荐-->
    <Recommend></Recommend>
    <!-- 商品排行 -->
    <Rank></Rank>
    <!-- 猜你喜欢 -->
    <Like></Like>
    <!-- 楼层 -->
    <!-- :floor="floor"好像是为了传参 -->
    <Floor
      v-for="floor in floorsList"
      :key="floor.id"
      :floor="floor"
      :cname="'floor-swiper' + floor.id"
    ></Floor>
    <!-- 楼层 -->
    <!-- <Floor></Floor> -->
    <!-- 商标 -->
    <Brand></Brand>
  </div>
</template>

<script>
import { mapState } from "vuex";
// import TypeNav from './TypeNav'//在全局注册了，所以这里就不需要了
import ListContainer from "./ListContainer";
import Recommend from "./Recommend";
import Rank from "./Rank";
import Like from "./Like";
import Floor from "./Floor";
import Brand from "./Brand";
export default {
  name: "Home",
  components: {
    // TypeNav,
    ListContainer,
    Recommend,
    Rank,
    Like,
    Floor,
    Brand,
  },
  computed: {
    ...mapState("home", ["floorsList"]),
  },
  mounted() {
    // 获取楼层数据
    // 因为home组件一挂载，就分发一个获取楼层数据的actions
    //因为home决定着要生成几个floor
    // this.$store.dispatch('getFloorsListData')

    // 开启模块化后的方法方式
    this.$store.dispatch("home/getFloorsListData");
  },
};
</script>

<style></style>
